package org.example.zpqy.service;

import org.example.zpqy.bean.AppleOne;
import org.example.zpqy.repository.AppleOneRepository;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class AppleOneService {

    private final AppleOneRepository repository;

    public AppleOneService(AppleOneRepository repository) {
        this.repository = repository;
    }

    // 查询全部
    public List<AppleOne> findAll() {
        return repository.findAll();
    }

    // 按属性查询
    public AppleOne findByAttribute(String attribute) {
        return repository.findByAttribute(attribute);
    }

    // 保存或更新
    public AppleOne save(AppleOne appleOne) {
        return repository.save(appleOne);
    }
}
